#include<stdio.h>
struct chocolate
{
	int hi;
	int wi;
};
struct chocolate c[1005];
int main()
{
	int k,n,count=1;
	int i,j=1;
	int maxWi=0,minWi=1,midWi,sum1=0,sum2=0;
	scanf("%d%d",&k,&n);getchar();
	for(i=0;i<k;i++)
	{
		scanf("%d%d",&c[i].hi,&c[i].wi);
		maxWi = maxWi > c[i].wi ? maxWi : c[i].wi;
	}
	do
	{
		midWi=(minWi+maxWi)/2;
		sum1=sum2=0;
		for(i=0;i<k;i++)
		{
			sum1+=(c[i].hi/midWi)*(c[i].wi/midWi);
			sum2+=(c[i].hi/(midWi+1))*(c[i].wi/(midWi+1));
		}
			
		if(sum1>=n&&sum2<n)
			break;
		else if(sum1<n)
			maxWi=midWi-1;
		else if(sum2>=n)
			minWi=midWi+1;
	}while(minWi<=maxWi);
	printf("%d\n",midWi);
	return 0;
}
